<!--页面 -->
<template>
	<div class="max-minwidth">
		<div class="ytw">
			<tabnav ref="tabnav" @navtagfun="navtagfun" ></tabnav>
			<div class="ytwblock">
				<usermsg v-if="navtag == 0"></usermsg>
				<information v-if="navtag == 1" :bookSendMsgdata="bookSendMsgdata" :ordersendMsgdata="ordersendMsgdata" @ordermsg="ordermsg" @initWebSocket="initWebSocket"></information>
				<order v-if="navtag == 2"></order>
				<addressBook v-if="navtag == 3" @bookSendMsg="bookSendMsg"></addressBook>
				<member v-if="navtag == 4"></member>
				<appoint v-if="navtag == 5"></appoint>
			</div>
		</div>
		<el-dialog
		  title="去评价"
		  :visible.sync="isGoEvalDia"
		  width="400px"
		  :before-close="diaClosefun"
		  :modal-append-to-body="false"
		  >
		  <div class="GoEvalDia">
			<p class="GoEvalDiamsg">您的订单已完成，可以去给设计师进行评价啦~</p>
			<div class="GoEvalDiabtn flex">
				<div class="GoEvalDiab-each curpoin baiColor" style="background-color: #999999;" @click="isGoEvalDia=false">取消</div>
				<div class="GoEvalDiab-each curpoin mainbg baiColor" @click="goorderxq()">确定</div>
			</div>
		  </div>
		</el-dialog>
		<el-dialog id="createorder" title="订单详情" :visible.sync="isorderxq" width="740px" top="20px"
			:before-close="diaClosefun" :modal-append-to-body="false">
			<div class="rblock">
				<orderxq :orderitem="orderitem" ref="orderxq"></orderxq>
			</div>
		</el-dialog>
	</div>
</template>

<script>
	import tabnav from '@/components/tabnav';
	import usermsg from '@/views/fun/usermsg';  // 个人中心
	import information from '@/views/fun/information';  // 消息
	import order from '@/views/fun/order';  // 订单
	import addressBook from '@/views/fun/addressBook';  // 通讯录
	import member from '@/views/fun/member';  // 成员管理
	import appoint from '@/views/fun/appoint';  // 指派管理
	export default {
		components:{
			tabnav,
			usermsg,
			information,
			order,
			addressBook,
			member,
			appoint
		},
		data(){
			return {
				roleId:'',
				navtag:1,
				bookSendMsgdata:{},
				ordersendMsgdata:{},
				isGoEvalDia:false,  // 订单完成提示去评价
				isorderxq:false,
				orderitem:{}
			}
		},
		mounted(){
			this.roleId = this.$store.state.roleId;
			this.electron.ipcRenderer.send('maxsize');  // 窗口大小
			this.electron.ipcRenderer.send('center');  // 窗口居中
			// if(this.roleId == 5){
			// 	this.overOrderRemind()
			// }
		},
		computed:{
			ordersendMsg(data){
				let orderdata = this.$store.state.orderSendSmgData;
				return orderdata
			}
		},
		watch:{
			/*
			1、sendIdentity-> 1设计师找给客户聊  2客户找设计师聊 
			2、设计师基本信息：design_xx；客户基本信息user_xx
			3、adverseid   对方id
			*/ 
			ordersendMsg(data){
				this.navtag = 1;
				this.$refs.tabnav.navtag(1);
				this.ordersendMsgdata = data || {};
			}
		},
		methods:{
			initWebSocket(){  // 断网重连
				this.$refs.tabnav.initWebSocket();
			},
			overOrderRemind(){  // 登录成功后评价提醒
				this.apifun.$post('/group/eval/overOrderRemind', {}).then((res) => {
					// console.log(res)
					if (res.code == 200) {
						let datas = res.data || {};
						if(datas.id){
							this.orderitem = datas;
							this.isGoEvalDia = true;
						}
					}
				})
			},
			goorderxq(){  // 提醒评价；跳转订单详情页
				this.isGoEvalDia = false;
				this.isorderxq = true;
			},
			navtagfun(tag){
				this.navtag = tag;
				if(tag == 1){
					this.bookSendMsgdata={};
					this.ordersendMsgdata={};
				}
			},
			bookSendMsg(res){  // 通讯录进入发消息
				this.navtag = 1;
				this.$refs.tabnav.navtag(1);
				this.bookSendMsgdata = res;
			},
			ordermsg(ordermsg){
				this.ordersendMsgdata = ordermsg
			},
			diaClosefun(){
				this.isGoEvalDia = false;
				this.isorderxq = false;
			}
		}
	}
</script>

<style scoped lang="scss">
	.ytw{
		position:fixed;
		width: 100%;
		height: 99vh;
		min-width:900px;
		min-height:600px;
		display: flex;
		background-color: #fff;
	}
	.ytwblock{
		width:100%;
	}
	// 弹窗
	.GoEvalDiabtn {
		padding-bottom: 20px;
		margin-top: 30px;
		display: flex;
		justify-content: flex-end;
	
		.GoEvalDiab-each {
			width: 130px;
			height: 50px;
			line-height: 50px;
			border-radius: 10px;
			color: #fff;
			font-size: 16px;
			margin-left: 25px;
			text-align: center;
		}
	}
</style>